<?php
class Admin_RedirectController extends Zen_Controller_Admin
{
	public function indexAction(){
		$file=ROOT_PATH . "/redirect";
		$form=new Admin_Form_Redirect();
		if($this->_request->isPost()){
			if($form->isValid($this->_getAllParams())){
				$params = $form->getValues();
				file_put_contents($file, $params['text']);
				$this->_helper->FlashMessenger->setNamespace ( 'messages' )->addMessage ( array ('text' => 'Изменения сохранены', 'type' => 'alert' ) );
				$this->_redirect($_SERVER['REQUEST_URI']);
			}
		}else{
			
			$content = file_get_contents($file);
			$params['text'] = $content;
			$form->setDefaults($params);
		}
		$this->view->form=$form;
	}
}
    